//
//  OtherClassCell.m
//  gungunchou
//
//  Created by lyzbmacos3 on 2018/12/4.
//  Copyright © 2018年 xskj. All rights reserved.
//

#import "OtherClassCell.h"
#import "CategorieCell.h"

@implementation OtherClassCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.collectV.delegate = self;
    self.collectV.dataSource = self;
    [self.collectV registerNib:[UINib nibWithNibName:@"CategorieCell" bundle:nil] forCellWithReuseIdentifier:@"CategorieCell"];
}

#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    //    return self.dataList.count;
    return 4;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *imgArr = @[@"home_goods",@"home_score",@"home_order",@"home_center"];
    NSArray *nameArr = @[@"商品列表",@"积分",@"我的订单",@"我的"];
    CategorieCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CategorieCell" forIndexPath:indexPath];
    cell.imgV.image = [UIImage imageNamed:imgArr[indexPath.item]];
    cell.nameLbl.text = nameArr[indexPath.item];
    return cell;
}

#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    if (self.delegate && [self.delegate respondsToSelector:@selector(OtherClassCell_ItemClickWithIndex:)]) {
        [self.delegate OtherClassCell_ItemClickWithIndex:indexPath.item];
    }
}

#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    return CGSizeMake(SCREEN_WIDTH/4.0, 100);
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
    return UIEdgeInsetsZero;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
    return 0;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
    return 0;
}

@end
